#include <DallasTemperature.h>
#include <ST7565.h>

enum MODE{
  NORMAL,SET_HOUR,SET_MINUTE,SELECT_HOUR,SET_TEMP};

class Thermostat
{
public:
  Thermostat();
  void update();
  void draw();

private:
  const int ONE_WIRE_BUS;
  const int LDR_PIN;    		    // analog pin of onboard lightsensor 
  const int GREEN_LED_PIN;               // Green tri-color LED
  const int RED_LED_PIN;                 // Red tri-color LED
  const int ENTER_PIN;
  const int UP_PIN;
  const int DOWN_PIN;
  DallasTemperature sensors;
  OneWire oneWire;

  int getSecond();
  int getMinute();
  int getHour();
  int getProgramHour();
  void addHours(int hours);
  void addMinutes(int minutes);
  void addSeconds(int seconds);
  void addMillis(int ms);
  double getTemperatureF();
  double getTemperatureC();

  void drawTemperature();
  void drawTime();
  void drawLeds();
  void drawMode();
  void drawProgrammedTemperature();
  void drawProgramTime();

  MODE mode;
  void fastUpdate(int now);
  void slowUpdate(int now);

  int hour;
  int minute;
  int second;
  int ms;
  float temperature;

  int fast_update_interval;
  int slow_update_interval;
  int last_slow_update;
  int last_fast_update;

  int last_button_push;
  int  mode_reset_delay;

  boolean up_button;
  boolean down_button;
  boolean enter_button;

  float program[24];
  int programHour;

};


